package com.aiyige.page.home.adapter;

import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ImageSpan;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.aiyige.R;
import com.aiyige.arouter.Router;
import com.aiyige.arouter.config.ARouterConfig;
import com.aiyige.city.model.City;
import com.aiyige.model.moment.entity.MajorCourse;
import com.aiyige.model.moment.entity.Moment;
import com.aiyige.page.detail.DetailPage;
import com.aiyige.utils.AccountUtil;
import com.aiyige.utils.CenteredImageSpan;
import com.aiyige.utils.DateFormatUtil;
import com.aiyige.utils.DummyDataUtil;
import com.aiyige.utils.GlideUtil;
import com.aiyige.utils.ListUtil;
import com.aiyige.utils.StringUtils;
import com.aiyige.utils.UIHelper;
import com.aiyige.utils.WebImageUrlModifier;
import com.aiyige.utils.widget.RoundCornerImageView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.vondear.rxtools.RxTextTool;

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by zhuyakun on 2017/10/17.
 */

public class HomeAdapter extends BaseQuickAdapter<Moment, BaseViewHolder> {

    public HomeAdapter() {
        super(new LinkedList<Moment>());
    }


    @Override
    protected void convert(BaseViewHolder helper, Moment item) {
        switch (item.getSubjectIndex()) {
//            case Moment.TYPE_AD:
//                ((AdViewHolder) helper).bindData(item);
//                break;
            case Moment.SUBJECT_PHOTO_INDEX:
                ((PhotoViewHolder) helper).bindData(item);
                break;
            case Moment.SUBJECT_SPECIAL_TOPIC_INDEX:
                ((SpecialTopicViewHolder) helper).bindData(item);
                break;
            case Moment.SUBJECT_VIDEO_INDEX:
                ((VideoViewHolder) helper).bindData(item);
                break;
            case Moment.SUBJECT_ARTICLE_INDEX:
                ((InfoViewHolder) helper).bindData(item);
                break;
            case Moment.SUBJECT_VIDEO_COURSE_INDEX:
                ((LearnVideoViewHolder) helper).bindData(item);
                break;
            case Moment.SUBJECT_MAJOR_COURSE_INDEX:
                ((MajorCourseViewHolder) helper).bindData(item);
                break;
        }
    }


    @Override
    protected int getDefItemViewType(int position) {
        return mData.get(position).getSubjectIndex();
    }

    @Override
    protected BaseViewHolder onCreateDefViewHolder(ViewGroup parent, int viewType) {
        BaseViewHolder baseViewHolder;
        switch (viewType) {
//            case Moment.TYPE_AD:
//                baseViewHolder = new AdViewHolder(getItemView(R.layout.home_ad_item, parent));
//                break;
            case Moment.SUBJECT_PHOTO_INDEX:
                baseViewHolder = new PhotoViewHolder(getItemView(R.layout.home_photo_item, parent));
                break;
            case Moment.SUBJECT_SPECIAL_TOPIC_INDEX:
                baseViewHolder = new SpecialTopicViewHolder(getItemView(R.layout.home_special_topic_item, parent));
                break;
            case Moment.SUBJECT_VIDEO_INDEX:
                baseViewHolder = new VideoViewHolder(getItemView(R.layout.home_video_item, parent));
                break;
            case Moment.SUBJECT_ARTICLE_INDEX:
                baseViewHolder = new InfoViewHolder(getItemView(R.layout.home_info_item, parent));
                break;
            case Moment.SUBJECT_MAJOR_COURSE_INDEX:
                baseViewHolder = new MajorCourseViewHolder(getItemView(R.layout.major_course_item, parent));
                break;
            case Moment.SUBJECT_VIDEO_COURSE_INDEX:
                baseViewHolder = new LearnVideoViewHolder(getItemView(R.layout.learn_video_item, parent));
                break;
            default:
                baseViewHolder = new BaseViewHolder(getItemView(R.layout.wild_card_item, parent));
                break;
        }
        return baseViewHolder;
    }


    public class AdViewHolder extends BaseViewHolder {
        Moment record;
        @BindView(R.id.adIv)
        RoundCornerImageView adIv;

        public AdViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }


        public void bindData(Moment data) {
            record = data;
            Glide.with(itemView.getContext())
                    .load(data.getCover())
                    .apply(RequestOptions.placeholderOf(R.drawable.default_image_bg))
                    .into(adIv);
        }

        @OnClick({R.id.adIv, R.id.containerLayout})
        public void onViewClicked(View view) {
            switch (view.getId()) {
                case R.id.adIv:
                    break;
                case R.id.containerLayout:
                    break;
            }
        }
    }

    public class PhotoViewHolder extends BaseViewHolder {
        Moment record;
        @BindView(R.id.avatarIv)
        ImageView avatarIv;
        @BindView(R.id.userNameTv)
        TextView userNameTv;
        @BindView(R.id.releaseDateTv)
        TextView releaseDateTv;
        @BindView(R.id.watchNumTv)
        TextView watchNumTv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.likeIv)
        ImageView likeIv;
        @BindView(R.id.likeTv)
        TextView likeTv;
        @BindView(R.id.commentIv)
        ImageView commentIv;
        @BindView(R.id.commentTv)
        TextView commentTv;
        @BindView(R.id.collectionIv)
        ImageView collectionIv;
        @BindView(R.id.collectionTv)
        TextView collectionTv;

        @BindView(R.id.onePhotoLayout)
        View onePhotoLayout;

        @BindView(R.id.twoPhotoLayout)
        View twoPhotoLayout;

        @BindView(R.id.threePhotoLayout)
        View threePhotoLayout;

        @BindView(R.id.onePhotoIv)
        ImageView onePhotoIv;

        @BindView(R.id.twoPhotoIv0)
        ImageView twoPhotoIv0;

        @BindView(R.id.twoPhotoIv1)
        ImageView twoPhotoIv1;

        @BindView(R.id.threePhotoIv0)
        ImageView threePhotoIv0;

        @BindView(R.id.threePhotoIv1)
        ImageView threePhotoIv1;

        @BindView(R.id.threePhotoIv2)
        ImageView threePhotoIv2;


        public PhotoViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }


        public void bindData(Moment data) {
            record = data;
            GlideUtil.with(itemView.getContext())
                    .loadAvatar(record.getCreatorBackup().getAvatar())
                    .into(avatarIv);
            int showCoverNum = 0;
            if (record.getCover() != null) {
                showCoverNum = record.getCover().size() > 3 ? 3 : record.getCover().size();
            }
            switch (showCoverNum) {
                case 3: {
                    onePhotoLayout.setVisibility(View.INVISIBLE);
                    twoPhotoLayout.setVisibility(View.INVISIBLE);
                    threePhotoLayout.setVisibility(View.VISIBLE);
                    GlideUtil.with(itemView.getContext())
                            .small()
                            .loadCover(record.getCover().get(0))
                            .into(threePhotoIv0);
                    GlideUtil.with(itemView.getContext())
                            .small()
                            .loadCover(record.getCover().get(1))
                            .into(threePhotoIv1);
                    GlideUtil.with(itemView.getContext())
                            .small()
                            .loadCover(record.getCover().get(2))
                            .into(threePhotoIv2);
                    break;
                }
                case 2: {
                    onePhotoLayout.setVisibility(View.INVISIBLE);
                    twoPhotoLayout.setVisibility(View.VISIBLE);
                    threePhotoLayout.setVisibility(View.INVISIBLE);
                    GlideUtil.with(itemView.getContext())
                            .middle()
                            .loadCover(WebImageUrlModifier.bigImage(record.getCover().get(0)))
                            .into(twoPhotoIv0);
                    GlideUtil.with(itemView.getContext())
                            .middle()
                            .loadCover(WebImageUrlModifier.bigImage(record.getCover().get(1)))
                            .into(twoPhotoIv1);
                    break;
                }
                case 1: {
                    onePhotoLayout.setVisibility(View.VISIBLE);
                    twoPhotoLayout.setVisibility(View.INVISIBLE);
                    threePhotoLayout.setVisibility(View.INVISIBLE);
                    GlideUtil.with(itemView.getContext())
                            .big()
                            .loadCover(record.getCover().get(0))
                            .into(onePhotoIv);
                    break;
                }
                case 0: {
                    onePhotoLayout.setVisibility(View.INVISIBLE);
                    twoPhotoLayout.setVisibility(View.INVISIBLE);
                    threePhotoLayout.setVisibility(View.INVISIBLE);
                    break;
                }

            }
            userNameTv.setText(record.getCreatorBackup().getName());
            releaseDateTv.setText(DateFormatUtil.getStandardDate(record.getOnsellTime()));
            watchNumTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getViewCount()));
            titleTv.setText(record.getTitle());
            likeTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getPraiseCount()));
            collectionTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getFavoriteCount()));
            commentTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getCommentCount()));
        }

        @OnClick({R.id.avatarIv, R.id.userNameTv, R.id.containerLayout})
        public void onViewClicked(View view) {
            switch (view.getId()) {
                case R.id.avatarIv:
                case R.id.userNameTv:
                    ARouter.getInstance().build(ARouterConfig.UserPage)
                            .withString("userId", record.getCreatorBackup().getId())
                            .navigation();
                    break;
                case R.id.containerLayout:
                    Router.start(record.getRouter());
                    break;
            }
        }
    }

    public class SpecialTopicViewHolder extends BaseViewHolder {
        Moment record;
        @BindView(R.id.avatarIv)
        ImageView avatarIv;
        @BindView(R.id.userNameTv)
        TextView userNameTv;
        @BindView(R.id.releaseDateTv)
        TextView releaseDateTv;
        @BindView(R.id.coverIv)
        ImageView coverIv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.likeIv)
        ImageView likeIv;
        @BindView(R.id.likeTv)
        TextView likeTv;
        @BindView(R.id.commentIv)
        ImageView commentIv;
        @BindView(R.id.commentTv)
        TextView commentTv;
        @BindView(R.id.collectionIv)
        ImageView collectionIv;
        @BindView(R.id.collectionTv)
        TextView collectionTv;
        @BindView(R.id.watchNumTv)
        TextView watchNumTv;


        public SpecialTopicViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }


        public void bindData(Moment data) {
            record = data;
            GlideUtil.with(itemView.getContext())
                    .loadCover(ListUtil.isEmpty(record.getCover()) ? "" : record.getCover().get(0))
                    .into(coverIv);
            GlideUtil.with(itemView.getContext())
                    .loadAvatar(record.getCreatorBackup().getAvatar())
                    .into(avatarIv);
            ImageSpan articleImageLabel = new CenteredImageSpan(itemView.getContext(), R.drawable.home_topic);
            watchNumTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getViewCount()));
            SpannableString spannableString = new SpannableString("  " + record.getTitle());
            spannableString.setSpan(articleImageLabel, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            titleTv.setText(spannableString);
            releaseDateTv.setText(DateFormatUtil.getStandardDate(record.getOnsellTime()));
            likeTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getPraiseCount()));
            collectionTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getFavoriteCount()));
            commentTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getCommentCount()));
            userNameTv.setText(record.getCreatorBackup().getName());
        }

        @OnClick({R.id.avatarIv, R.id.userNameTv, R.id.containerLayout})
        public void onViewClicked(View view) {
            switch (view.getId()) {
                case R.id.avatarIv:
                case R.id.userNameTv:
                    ARouter.getInstance().build(ARouterConfig.UserPage)
                            .withString("userId", record.getCreatorBackup().getId())
                            .navigation();
                    break;
                case R.id.containerLayout:
                    Router.start(record.getRouter());
                    break;
            }
        }

    }

    public class VideoViewHolder extends BaseViewHolder {
        Moment record;
        @BindView(R.id.avatarIv)
        ImageView avatarIv;
        @BindView(R.id.userNameTv)
        TextView userNameTv;
        @BindView(R.id.releaseDateTv)
        TextView releaseDateTv;
        @BindView(R.id.coverIv)
        ImageView coverIv;
        @BindView(R.id.watchNumTv)
        TextView watchNumTv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.likeIv)
        ImageView likeIv;
        @BindView(R.id.likeTv)
        TextView likeTv;
        @BindView(R.id.commentIv)
        ImageView commentIv;
        @BindView(R.id.commentTv)
        TextView commentTv;
        @BindView(R.id.collectionIv)
        ImageView collectionIv;
        @BindView(R.id.collectionTv)
        TextView collectionTv;

        public VideoViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }


        public void bindData(Moment data) {
            record = data;
            GlideUtil.with(itemView.getContext())
                    .big()
                    .loadCover(ListUtil.isEmpty(record.getCover()) ? "" : record.getCover().get(0))
                    .into(coverIv);
            GlideUtil.with(itemView.getContext())
                    .small()
                    .loadAvatar(record.getCreatorBackup().getAvatar())
                    .into(avatarIv);
            watchNumTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getViewCount()));
            titleTv.setText(record.getTitle());
            releaseDateTv.setText(DateFormatUtil.getStandardDate(record.getOnsellTime()));
            likeTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getPraiseCount()));
            collectionTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getFavoriteCount()));
            commentTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getCommentCount()));
            userNameTv.setText(record.getCreatorBackup().getName());
        }

        @OnClick({R.id.avatarIv, R.id.userNameTv, R.id.containerLayout})
        public void onViewClicked(View view) {
            switch (view.getId()) {
                case R.id.avatarIv:
                case R.id.userNameTv:
                    ARouter.getInstance().build(ARouterConfig.UserPage)
                            .withString("userId", record.getCreatorBackup().getId())
                            .navigation();
                    break;
                case R.id.containerLayout:
                    Router.start(record.getRouter());
                    break;
            }
        }
    }

    public class InfoViewHolder extends BaseViewHolder {
        Moment record;
        @BindView(R.id.avatarIv)
        ImageView avatarIv;
        @BindView(R.id.userNameTv)
        TextView userNameTv;
        @BindView(R.id.releaseDateTv)
        TextView releaseDateTv;
        @BindView(R.id.coverIv)
        ImageView coverIv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.likeIv)
        ImageView likeIv;
        @BindView(R.id.likeTv)
        TextView likeTv;
        @BindView(R.id.commentIv)
        ImageView commentIv;
        @BindView(R.id.commentTv)
        TextView commentTv;
        @BindView(R.id.collectionIv)
        ImageView collectionIv;
        @BindView(R.id.collectionTv)
        TextView collectionTv;
        @BindView(R.id.watchNumTv)
        TextView watchNumTv;


        public InfoViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }


        public void bindData(Moment data) {
            record = data;
            GlideUtil.with(itemView.getContext())
                    .big()
                    .loadCover(ListUtil.isEmpty(record.getCover()) ? "" : record.getCover().get(0))
                    .into(coverIv);
            GlideUtil.with(itemView.getContext())
                    .small()
                    .loadAvatar(record.getCreatorBackup().getAvatar())
                    .into(avatarIv);
            ImageSpan articleImageLabel = new CenteredImageSpan(itemView.getContext(), R.drawable.home_article);
            watchNumTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getViewCount()));
            SpannableString spannableString = new SpannableString("  " + record.getTitle());
            spannableString.setSpan(articleImageLabel, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            titleTv.setText(spannableString);
            releaseDateTv.setText(DateFormatUtil.getStandardDate(record.getOnsellTime()));
            likeTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getPraiseCount()));
            collectionTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getFavoriteCount()));
            commentTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getCommentCount()));
            userNameTv.setText(record.getCreatorBackup().getName());
        }

        @OnClick({R.id.avatarIv, R.id.userNameTv, R.id.containerLayout})
        public void onViewClicked(View view) {
            switch (view.getId()) {
                case R.id.avatarIv:
                case R.id.userNameTv:
                    ARouter.getInstance().build(ARouterConfig.UserPage)
                            .withString("userId", record.getCreatorBackup().getId())
                            .navigation();
                    break;
                case R.id.containerLayout:
                    Router.start(record.getRouter());
                    break;
            }
        }
    }


    public class LearnVideoViewHolder extends BaseViewHolder {
        @BindView(R.id.avatarIv)
        ImageView avatarIv;
        @BindView(R.id.verifyIv)
        ImageView verifyIv;
        @BindView(R.id.userNameTv)
        TextView userNameTv;
        @BindView(R.id.freeTv)
        TextView freeTv;
        @BindView(R.id.priceTv)
        TextView priceTv;
        @BindView(R.id.priceLayout)
        LinearLayout priceLayout;
        @BindView(R.id.priceContainer)
        FrameLayout priceContainer;
        @BindView(R.id.buyNumTv)
        TextView buyNumTv;
        @BindView(R.id.coverIv)
        ImageView coverIv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.watchNumTv)
        TextView watchNumTv;
        @BindView(R.id.likeIv)
        ImageView likeIv;
        @BindView(R.id.likeTv)
        TextView likeTv;
        @BindView(R.id.commentIv)
        ImageView commentIv;
        @BindView(R.id.commentTv)
        TextView commentTv;
        @BindView(R.id.collectionIv)
        ImageView collectionIv;
        @BindView(R.id.collectionTv)
        TextView collectionTv;
        @BindView(R.id.containerLayout)
        LinearLayout containerLayout;
        Moment record;

        public LearnVideoViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(Moment data) {
            record = data;
            GlideUtil.with(itemView.getContext())
                    .big()
                    .loadCover(ListUtil.isEmpty(data.getCover()) ? "" : data.getCover().get(0))
                    .into(coverIv);
            titleTv.setText(data.getTitle());
            GlideUtil.with(itemView.getContext())
                    .loadAvatar(WebImageUrlModifier.smallImage(data.getCreatorBackup().getAvatar()))
                    .into(avatarIv);
            userNameTv.setText(data.getCreatorBackup().getName());
//            if (data.price < 0.01) {
//                priceLayout.setVisibility(View.INVISIBLE);
//                freeTv.setVisibility(View.VISIBLE);
//            } else {
            priceLayout.setVisibility(View.VISIBLE);
            freeTv.setVisibility(View.INVISIBLE);
            priceTv.setText(StringUtils.priceFormat(data.getCommodityBackup().getPrice()));
//            }
            buyNumTv.setText(String.format(StringUtils.getString(R.string.buy_num), StringUtils.formatNum(data.getStatisticsBackup().getSellCount())));
            watchNumTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getViewCount()));
            likeTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getPraiseCount()));
            collectionTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getFavoriteCount()));
            commentTv.setText(StringUtils.formatNum(record.getStatisticsBackup().getCommentCount()));
        }

        @OnClick({R.id.containerLayout, R.id.avatarIv, R.id.userNameTv})
        public void onViewClick(View v) {
            switch (v.getId()) {
                case R.id.containerLayout:
                    Router.start(record.getRouter());
                    break;
                case R.id.userNameTv:
                case R.id.avatarIv:
                    ARouter.getInstance()
                            .build(ARouterConfig.UserPage)
                            .withString("userId", record.getCreatorBackup().getId())
                            .navigation();
                    break;
            }
        }
    }

    public class MajorCourseViewHolder extends BaseViewHolder {
        @BindView(R.id.avatarIv)
        ImageView avatarIv;
        @BindView(R.id.verifyIv)
        ImageView verifyIv;
        @BindView(R.id.userNameTv)
        TextView userNameTv;
        @BindView(R.id.freeTv)
        TextView freeTv;
        @BindView(R.id.priceTv)
        TextView priceTv;
        @BindView(R.id.priceLayout)
        LinearLayout priceLayout;
        @BindView(R.id.priceContainer)
        FrameLayout priceContainer;
        @BindView(R.id.spacesTv)
        TextView spacesTv;
        @BindView(R.id.coverIv)
        ImageView coverIv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.titleLayout)
        FrameLayout titleLayout;
        @BindView(R.id.locationTv)
        TextView locationTv;
        @BindView(R.id.locationLayout)
        LinearLayout locationLayout;
        @BindView(R.id.openClassDateTv)
        TextView openClassDateTv;
        @BindView(R.id.containerLayout)
        LinearLayout containerLayout;
        Moment record;

        public MajorCourseViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(Moment data) {
            record = data;
            GlideUtil.with(itemView.getContext())
                    .loadAvatar(record.getCreatorBackup().getAvatar())
                    .into(avatarIv);
            titleTv.setText(record.getTitle());
            GlideUtil.with(itemView.getContext())
                    .big()
                    .loadCover(ListUtil.isEmpty(record.getCover()) ? "" : record.getCover().get(0))
                    .into(coverIv);
            userNameTv.setText(record.getCreatorBackup().getName());
            priceLayout.setVisibility(View.VISIBLE);
            freeTv.setVisibility(View.INVISIBLE);
            priceTv.setText(StringUtils.priceFormat(data.getCommodityBackup().getPrice()));
            spacesTv.setText(String.format(StringUtils.getString(R.string.spaces), String.valueOf(data.getInventoryBackup().getAvailableInventory() == null ? 0 : data.getInventoryBackup().getAvailableInventory())));
            try {
                MajorCourse majorCourse = JSON.parseObject(record.getMoreBackup(), MajorCourse.class);
                openClassDateTv.setText(DateFormatUtil.formatMS("yyyy-MM-dd", majorCourse.getStartDate()));
            } catch (Exception e) {
                openClassDateTv.setText("");
            }
            try {
                City city = DummyDataUtil.getCityById(record.getCityId());
                locationTv.setText(city.getCity());
            } catch (Exception e) {
                locationTv.setText("");
            }

        }

        @OnClick({R.id.avatarIv, R.id.userNameTv, R.id.containerLayout})
        public void onViewClick(View v) {
            switch (v.getId()) {
                case R.id.avatarIv:
                case R.id.userNameTv:
                    ARouter.getInstance()
                            .build(ARouterConfig.UserPage)
                            .withString("userId", record.getCreatorBackup().getId())
                            .navigation();
                    break;
                case R.id.containerLayout:
                    Router.start(record.getRouter());
                    break;
            }
        }

    }

}
